Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

diff-match-patch

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diff-match-patch

npm package for https://github.com/google/diff-match-patch

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is diff-match-patch?

The diff-match-patch library offers robust algorithms to perform the operations required for synchronizing plain text. With diff-match-patch, you can compute character-based diffs, efficient patch application, and real-time merging of text documents. This library is useful for text editors, version control systems, and for applications that need to handle text patching and diff operations.

What are diff-match-patch's main functionalities?

Diff

Computes the difference between two texts and returns the result. It can also clean up the diff for a more human-readable format.

const DiffMatchPatch = require('diff-match-patch');
const dmp = new DiffMatchPatch();
const diff = dmp.diff_main('Hello World', 'Hallo Welt');
dmp.diff_cleanupSemantic(diff);
console.log(diff);

Patch

Creates and applies patches to a text. Patches can be used to transform text to its updated version efficiently.

const DiffMatchPatch = require('diff-match-patch');
const dmp = new DiffMatchPatch();
const patches = dmp.patch_make('Hello World', 'Hallo Welt');
const results = dmp.patch_apply(patches, 'Hello World');
console.log(results);

Match

Finds the best match of a shorter text within a longer one. This can be used for fuzzy searching or auto-correction.

const DiffMatchPatch = require('diff-match-patch');
const dmp = new DiffMatchPatch();
const match = dmp.match_main('Hello World', 'ell', 1);
console.log(match);

Other packages similar to diff-match-patch

Keywords

FAQs

Package last updated on 20 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc